library(RSofia);


train.rows <- sample(nrow(data), floor(0.7*nrow(data)));
train <- data[train.rows,];
test <- data[-train.rows,];


f <- IsBetter ~ poly(AnswerTextLength, AnswerTimeSec, AnswerUserReputation, AnswerUserNumMonths, degree=10)




f <- formula(data.svm);
model <- sofia(f, data.svm);

y <- sign(predict.sofia(model,data.svm,"linear"));
mean(y==data.svm$IsBetter)



y.test = predict.sofia(model,test,"linear")
> y.test = sign(y.test)
> sum(y.test==test$IsBetter)
